class Solution {
    public int peakIndexInMountainArray(int[] arr) {
        int left = 0;
        int rigth = arr.length -1;
        int xia = 0;
        int max = 0;
        while(left <= rigth) {
            if(arr[left] > max) {
                max = arr[left];
                xia = left;
            }
            if(arr[rigth] > max) {
                max = arr[rigth];
                xia = rigth;
            }
            left++;
            rigth--;
        }
        return xia;
    }
}